<!DOCTYPE html>
<html lang="zh-CN"  xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>学生过程化成绩信息 </title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" th:href="@{/static/vendor/bootstrap/css/bootstrap.min.css}">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" th:href="@{/static/css/fontastic.css}">
    <!-- theme stylesheet-->
    <link rel="stylesheet" th:href="@{/static/css/style.default.css}" id="theme-stylesheet"> 
  </head>
  <body>
    <div class="page">
      <!-- Main Navbar-->
      <header class="header">
        <nav class="navbar">
          <!-- Search Box-->
          <div class="search-box">
            <button class="dismiss"><i class="icon-close"></i></button>
            <form id="searchForm" action="#" role="search">
              <input type="search" placeholder="What are you looking for..." class="form-control">
            </form>
          </div>
          <div class="container-fluid">
            <div class="navbar-holder d-flex align-items-center justify-content-between">
              <!-- Navbar Header-->
              <div class="navbar-header">
                <!-- Navbar Brand --><a href="index.html" class="navbar-brand d-none d-sm-inline-block">
                <div class="brand-text d-none d-lg-inline-block"><strong>侧栏</strong></div>
                <div class="brand-text d-none d-sm-inline-block d-lg-none"><strong>BD</strong></div></a>
                <!-- Toggle Button--><a id="toggle-btn" href="#" class="menu-btn active"><span></span><span></span><span></span></a>
              </div>
              <!-- Navbar Menu -->
              <ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
                <!-- Search-->
                <li class="nav-item d-flex align-items-center"><a id="search" href="#"><i class="icon-search"></i></a></li>
                <!-- Notifications-->
                <li class="nav-item dropdown"> <a id="notifications" rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link"><i class="fa fa-bell-o"></i><span class="badge bg-red badge-corner">1</span></a>
                  <ul aria-labelledby="notifications" class="dropdown-menu">
                    <li><a rel="nofollow" href="#" class="dropdown-item">
                      <div class="notification">

                      </div></a></li>
                    <li><a rel="nofollow" href="#" class="dropdown-item all-notifications text-center"> <strong>view all notifications                                            </strong></a></li>
                  </ul>
                </li>
                <!-- Logout    -->
                <li class="nav-item"><a th:href="@{/logout}" class="nav-link logout"> <span class="d-none d-sm-inline">退出登录</span><i class="fa fa-sign-out"></i></a></li>
              </ul>
            </div>
          </div>
        </nav>
      </header>
      <div class="page-content d-flex align-items-stretch">
        <!-- Side Navbar -->
        <nav class="side-navbar">
          <!-- Sidebar Header-->
          <div class="sidebar-header d-flex align-items-center">
            <div class="avatar"><img th:src="@{/static/img/avatar-1.jpg}" alt="..." class="img-fluid rounded-circle"></div>
            <div class="title">
              <h1 class="h4" th:text="${session.Main.getSname()}"></h1>
              <p>学号:[[${session.loginUser}]]</p>
              <p>班级:[[${session.Main.getClassName().getClassname()}]]</p>
            </div>
          </div>
          <!-- Sidebar Navidation Menus--><span class="heading">Main</span>
          <ul class="list-unstyled">
            <li class="active"><a th:href="@{/students/StuScores/{cid}(cid=${cid})}"> </i>我的成绩 </a></li>
            <li><a th:href="@{/students/checkArrived/{cid}(cid=${cid})}"></i>签到情况 </a></li>
            <li><a th:href="@{/studentMain}"> <i class="icon-interface-windows"></i>返回学生主页 </a></li>
          </ul>
        </nav>
        <div class="content-inner">
          <!-- Page Header-->
          <header class="page-header">
            <div class="container-fluid">
              <h2 class="no-margin-bottom">我的成绩</h2>
            </div>
          </header>
          <!-- Dashboard Header Section    -->
          <div >
            <br>
            <table id="table" class="table table-hover table-bordered" border="1"align="center">

              <thead><tr class="font" align="center"><th>章节</th><th>重要性</th><th>成绩</th></tr></thead>
              <tbody>
              <tr th:each="c,cState:${chapters}" align="center">
                <td th:text="${c.toString()}"></td>

                <td th:each="h,hState:${hardness}" th:if="${cState.index}==${hState.index}" th:text="${h}+'⭐'"></td>

                <td th:each="s,sState:${scores}" th:if="${cState.index}==${sState.index}" th:text="${s}"></td>
              </tr>
              </tbody>
            </table>
          </div>
          <section class="dashboard-header">
            <div class="container-fluid">
              <div class="row">      
                <!-- Line Chart            -->
                <div class="chart col-lg-6 col-12">
                  <div class="line-chart bg-white d-flex align-items-center justify-content-center has-shadow">
                    <canvas id="lineCahrt"></canvas>
                    <script th:inline="javascript" type="text/javascript">
                        /*<![CDATA[*/
                        var chapter=[[${chapters}]];
                        var score=[[${scores}]];
                        var averScore=[[${CourseAver}]];
                        /*]]>*/

                        window.onload=function () {
                            for (var i=1;i<[[${chapters}]].length+1;i++){
                                var score=document.getElementById("table").rows[i].cells[2].innerHTML;
                                var s=Number(score);
                                if(s<60){
                                    document.getElementById("table").rows[i].cells[2].style.cssText="color:red;";
                                }else if(s>=60 && s<=65){
                                    document.getElementById("table").rows[i].cells[2].style.cssText="color:#ffd811;";
                                }else if(s>90){
                                    document.getElementById("table").rows[i].cells[2].style.cssText="color:#39c764;";
                                }
                            }

                        }
                    </script>
                  </div>
                </div>
                <div class="chart col-lg-3 col-12">
                
                  <!-- Numbers-->
                  <div class="statistic d-flex align-items-center bg-white has-shadow">
                    <div class="icon bg-green"></div>
                    <div class="text"><strong th:text="${aver}"></strong><br><small>当前平时成绩</small></div>
                  </div>
                </div>
              </div>
            </div>
          </section>
      </div>
    </div>
    <!-- JavaScript files-->
    <script th:src="@{/static/vendor/jquery/jquery.min.js}"></script>
    <script th:src="@{/static/vendor/popper.js/umd/popper.min.js}"> </script>
    <script th:src="@{/static/vendor/bootstrap/js/bootstrap.min.js}"></script>
    <script th:src="@{/static/vendor/jquery.cookie/jquery.cookie.js}"> </script>
    <script th:src="@{/static/vendor/chart.js/Chart.min.js}"></script>
    <script th:src="@{/static/vendor/jquery-validation/jquery.validate.min.js}"></script>
    <script th:src="@{/static/js/charts-home.js}"></script>
    <!-- Main File-->
    <script th:src="@{/static/js/front.js}"></script>
    </div>
  </body>
</html>